<template>
	<view class="index1_content">
		
		
		<!-- 运输 -->
		<WebView v-if="isOnShow && (identity_type===6 || identity_type===7)" />
		<!-- <Transport v-if="isOnShow && (identity_type===6 || identity_type===7)" /> -->
		<!-- 采购商 -->
		<Purchaser v-else-if="isOnShow && identity_type===3" />
		<!-- 专业代办 -->
		<Agency v-else-if="isOnShow && (identity_type===4 || identity_type===8 || identity_type===9)" />

		<!-- 货运代理 -->
		<WebView v-else-if="isOnShow && (identity_type===2||identity_type===5)" />
		<!-- <Goods  /> -->
		<!-- 供应商 -->
		<Gongyingshang v-else-if="isOnShow && (identity_type===0||identity_type===1)" />


		<IndexVue v-else />
	</view>
</template>

<script>
	import IndexVue from './index.vue'
	import Transport from './components/transport.vue'
	import Goods from './components/goods.vue'
	import Gongyingshang from './components/gongyingshang.vue'
	import Purchaser from './components/purchaser.vue'
	import Agency from './components/agency.vue'
	import WebView from "@/pages/zWebView/zWebView"
	export default {
		components: {
			Transport,
			Goods,
			Gongyingshang,
			IndexVue,
			Purchaser,
			Agency,
			WebView
		},
		data() {
			return {
				isOnShow: false, //刷新加载的子组件
				identity_type: '', //角色id
			}
		},
		onShow() {
			console.log('执行onShow')


			this.getLang()
			let identity_type = uni.getStorageSync('userInfoFull');
			this.identity_type = identity_type.identity_type
			// if (this.identity_type === 6 || this.identity_type === 7) {
			// 	this.$eventBus.$on('getTransport', () => {})
			// 	this.$eventBus.$emit('getTransport')
			// }
		},
		created() {
			this.isOnShow = false;
			this.$nextTick(() => {
				this.isOnShow = true;
			});
		},
		methods: {
			getLang() {
				// 获取缓存lang当前语言值
				uni.getStorage({
					key: 'lang',
					success: res => {
						if (res.data == 'zh') { //zh为中国，赋值0
							this.lang = 'zh'
						} else { //其他为俄罗斯，赋值1
							this.lang = 'ru'
						}
					}
				});
			},
		}
	}
</script>

<style scoped>
	.index1_content {
		width: 100%;
		height: calc(100%);
		height: calc(100% - constant(safe-area-inset-top));
		height: calc(100% - env(safe-area-inset-top));
		/* #ifdef APP-PLUS */
		height: calc(100vh);
		height: calc(100vh - constant(safe-area-inset-top));
		height: calc(100vh - env(safe-area-inset-top));
		/* #endif */
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	page {
		background-color: #F1F2F4;
	}
</style>